1. Field of the Invention
The present disclosure relates to a register, and more particularly, to a register for using an end flag for indicating a last valid byte position of the last word of a data packet and an end position of the data packet and a related method for utilizing the register.
2. Description of the Prior Art
In computer architectures, a register is one kind of high speed computer memory, which can accelerate executions of computer programs by providing quick access to values. Generally speaking, the register is usually estimated according to the number of bits to be saved, such as a register with 32 bits or a register with 64 bits.
Please refer to FIG. 1. FIG. 1 is a diagram illustrating a conventional register 100 for storing data packets according to the prior art. As shown in FIG. 1, the register 100 is implemented by a first in first out (FIFO) register. The register 100 includes a storage unit 110, an end flag 120, and a byte enable flag 130. The register 100 is a 32-bit register. As a result, each word in the storage unit 110 is used for storing a data of 32 bits. That is to say, each column in the storage unit 110 represents a word byte, and each word byte contains four bytes (e.g., Byte 0˜Byte 3). Furthermore, the storage unit 110 is used for storing at least one data packet, such as a first data packet, a second data packet . . . , and so on. The end flag 120 is used for indicating an end position of the first data packet at a position corresponding to the last column (e.g., the last word LW) of the data packet, and the byte enable flag 130 is used for indicating a last valid byte position of the last word LW of the first data packet at the position corresponding to the last column (e.g., the last word LW) of the data packet. For example, if a last valid byte of the last word LW of the first data packet includes Byte 0, the byte enable flag 130 uses two bits to be indicative of the value “00” at the position corresponding to the last column (e.g., the last word LW) of the first data packet. Under this condition, it represents that the last valid byte position of the last word LW of the first data packet is Byte 0. If the last valid bytes of the last word LW of the second data packet include Byte 0, Byte 1, and Byte 2, the byte enable flag 130 uses two bits to be indicative of the value “10” at the position corresponding to the last column (e.g., the last word LW) of the second data packet. Under this condition, it represents that the last valid byte position of the last word LW of the second data packet is Byte 2. The rest may be deduced by analogy.
Hence, how to reduce the amount of end flags of the register in order to lower the cost of the register has become an important issue to be solved by designers in this field.